﻿<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5移动端裁剪图片上传头像</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no, email=no" />
<!--[if IE]>
<script src="js/html5shiv.min.js"></script>
<![endif]-->
</head>
<body>
	<div class="half">
		<a class="logo" id="logox"></a>
	</div>
	<article class="htmleaf-container">
		<div id="clipArea"></div>
		<div class="foot-use">
			<div class="uploader1 blue">
				<input type="button" name="file" class="button" value="打开">
				<input id="file" type="file" accept="image/*" multiple  />
			</div>
			<button id="clipBtn">截取</button>
		</div>
		<div id="view"></div>
	</article>

<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery-2.1.1.min.js"></script>
<script src="js/iscroll-zoom.js"></script>
<script src="js/hammer.js"></script>
<script src="js/jquery.photoClip.js"></script>
<script>
$("#clipArea").photoClip({
	width: 199,
	height: 166,
	file: "#file",
	view: "#view",
	ok: "#clipBtn",
	loadStart: function() {
		console.log("照片读取中");
	},
	loadComplete: function() {
		console.log("照片读取完成");
	},
	clipFinish: function(dataURL) {
		console.log(dataURL);
	}
});
$(function(){
	$("#logox").click(function(){
		$(".htmleaf-container").show();
	})
	$("#clipBtn").click(function(){
		$("#logox").empty();
		$('#logox').append('<img src="' + imgsource + '" align="absmiddle" style=" width: 5rem;height: 4.16rem; margin-left: 1.5rem;margin-top: 1.92rem">');
		$(".htmleaf-container").hide();
	})
});
</script>
</body>
</html>

